home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7501 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: inforamp.net!usenet
  2. From: pitchl@tdbank.ca (Lew Pitcher)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Do you have ever pass structures?
  5. Date: Tue, 27 Feb 1996 01:16:52 GMT
  6. Organization: Toronto Dominion Bank
  7. Message-ID: <4gtm62$gjb@sam.inforamp.net>
  8. References: <4ge8mi$qjm@srvr1.engin.umich.edu> <4ggsio$343@news-f.iadfw.net> <4gqk11$e7l@airdmhor.gen.nz>
  9. NNTP-Posting-Host: ts29-12.tor.inforamp.net
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. gumboot@airdmhor.gen.nz (Simon Hosie) wrote:
  13.  
  14. >Adam Peterson:
  15. >> The *disadvantage* is speed and space. Passing a pointer is just
  16. >> word//double word.  Passing the actual structure requires loading the
  17. >> stack with all the elements of the structure...slow...
  18.  
  19. >  But once it's done you don't have this pointer-thing to dereference all
  20. >the time (of course, this depends on how much register space you have - will
  21. >I ever get over my Intelesque hangups?).
  22.  
  23. Yah, but you still wind up dereferencing a pointer (just this time
  24. it's the stack pointer). If you really want efficiency, then define a
  25. global structure variable, put your data into it, and let the called
  26. function access it directly. There should be less pointer
  27. dereferencing that way.
  28.  
  29.  
  30. Lew Pitcher             | "I'm a little source code
  31. Toronto Dominion Bank   |  Short and Stout
  32. =======================    |  Here is my Input,
  33. Enzo Matrix - Reboot    |  And here is my out"
  34.  
  35.